const TokenKey = "Admin-Token";
const ExpiresInKey = "Admin-Expires-In";
const RefreshKen = "refresh_token";

export function setLocalToken(tokenName = RefreshKen, token) {
  console.log("setLocalToken", tokenName, token);
  localStorage.setItem(tokenName, token);
}

export function getLocalToken(tokenName = RefreshKen) {
  return localStorage.getItem(tokenName) ?? "";
}
export function removeLocalStorage(key) {
  localStorage.removeItem(key);
}
export function setSissionStorage(key, value) {
  sessionStorage.setItem(key, value);
}
export function getSessionStorage(key) {
  return sessionStorage.getItem(key) ?? "";
}
export function removeSessionStorage(key) {
  sessionStorage.removeItem(key);
}
/**
 * 判断目标是否为空对象
 * @param target 待判断目标
 * @returns {boolean} true：是；false：不是
 * @unit_test Object.spec.ts
 */
export function isEmptyObject(target) {
  if (target) {
    return Object.keys(target).length === 0;
  } else {
    return false;
  }
}
